<?php
	$kode = $_POST['kode'];
	$nama = $_POST['name'];
	$deskripsi = $_POST['deskripsi'];
	$gambar = $_FILES['gambar']['name'];
	$harga = $_POST['harga'];
	$id_anime = $_POST['anime'];
	$id_kategori = $_POST['kategori'];
	$tag = $_POST['tag'];
	$meta_des = $_POST['meta_deskripsi'];
	$member = $_POST['member'];
	$umum = $_POST['umum'];

	if(isset($_POST['submit'])){
		$acak=rand(0000,9999);
		$lokasi_file=$_FILES['gambar']['tmp_name'];
		$nama_file1=$_FILES['gambar']['name'];
		$nama_file=$acak.$nama_file1;
		move_uploaded_file($lokasi_file,"../produk/"."$nama_file");
		
		$sttmt = $koneksi->exec("insert into produk (kode,nama_produk,deskripsi,gambar,harga,id_anime,id_kategori,meta_tag,meta_deskripsi,berat,diskon_member,diskon_umum) values ('$kode','$nama','$deskripsi','$nama_file',$harga,$id_anime,$id_kategori,'$tag','$meta_des',$member,$umum)");
	}
	
	$url_sukses='utama.php?module=mod_produk';
	if($sttmt){
		echo "<meta http-equiv='refresh' content='0; url=$url_sukses'>";
		exit;
	}else{
		echo mysql_error();
	}
?>